﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CADAutoPlot
{
    public static class Common
    {
        public static double GetValuesForKey(Dictionary<string, double> dict,string key)
        {
            if(dict.ContainsKey(key))
            {
                return dict[key];
            }
            return -1.0;
        }
        public static Object GetObjectValuesForKey(Dictionary<string, Object> dict, string key)
        {
            if (dict.ContainsKey(key))
            {
                return dict[key];
            }
            return null;
        }
        public static Dictionary<int,Array> getObjectMap(string value)
        {
            Dictionary<int, Array> dict = new Dictionary<int,Array>();
            //用,分割
            string[] vals = value.Split(',');
            
            for (int i=0;i < vals.Length;i++)
            {
                Array array = Array.CreateInstance(typeof(object), 1);
                string insertValue = vals[i].Replace("[", "").Replace("]", "");
                array.SetValue(insertValue, 0);
                dict.Add(i, array);
            }
            return dict;
        }
        public static bool isLegalDict(Dictionary<string, double> dict)
        {
            bool isLegal = true;

            return isLegal;
        }
    }
}
